import Loading from './Loading.vue'
import Vue from 'vue'

// 获取loading组件的构造函数，构造loading组件
const loadingConstructor = Vue.extend(Loading)

const loadingServe = ()=> {
    // 创建loading实例
    const instance = new loadingConstructor()
    // 将组件挂载到指定元素
    instance.$mount(document.createElement('div'))
    // 将组件挂载的元素添加到body的元素下
    document.body.appendChild(instance.$el)
    Vue.nextTick(()=> {
        instance.visible = true
    })
    return instance
}

export default loadingServe